1 -> 3 + 5 + 11 = 19 
2 -> 3 + 5 + 23 = 31 
3 -> 3 + 5 + 29 = 37 
4 -> 3 + 7 + 13 = 23 
5 -> 3 + 7 + 19 = 29 
6 -> 3 + 11 + 17 = 31 
7 -> 3 + 11 + 23 = 37 
8 -> 3 + 11 + 29 = 43 
9 -> 3 + 17 + 23 = 43 
10 -> 5 + 7 + 11 = 23 
11 -> 5 + 7 + 17 = 29 
12 -> 5 + 7 + 19 = 31 
13 -> 5 + 7 + 29 = 41 
14 -> 5 + 11 + 13 = 29 
15 -> 5 + 13 + 19 = 37 
16 -> 5 + 13 + 23 = 41 
17 -> 5 + 13 + 29 = 47 
18 -> 5 + 17 + 19 = 41 
19 -> 5 + 19 + 23 = 47 
20 -> 5 + 19 + 29 = 53 
21 -> 7 + 11 + 13 = 31 
22 -> 7 + 11 + 19 = 37 
23 -> 7 + 11 + 23 = 41 
24 -> 7 + 11 + 29 = 47 
25 -> 7 + 13 + 17 = 37 
26 -> 7 + 13 + 23 = 43 
27 -> 7 + 17 + 19 = 43 
28 -> 7 + 17 + 23 = 47 
29 -> 7 + 17 + 29 = 53 
30 -> 7 + 23 + 29 = 59 
31 -> 11 + 13 + 17 = 41 
32 -> 11 + 13 + 19 = 43 
33 -> 11 + 13 + 23 = 47 
34 -> 11 + 13 + 29 = 53 
35 -> 11 + 17 + 19 = 47 
36 -> 11 + 19 + 23 = 53 
37 -> 11 + 19 + 29 = 59 
38 -> 13 + 17 + 23 = 53 
39 -> 13 + 17 + 29 = 59 
40 -> 13 + 19 + 29 = 61 
41 -> 17 + 19 + 23 = 59 
42 -> 19 + 23 + 29 = 71 

If n, m, p < 1000 -> total number of triplets: 241580